package com.sjx.onelinecord.ui

import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.Fragment
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.sjx.onelinecord.R
import kotlinx.android.synthetic.main.fragment_study.*
import kotlinx.android.synthetic.main.item_fragment_study.view.*


class StudyFragment : Fragment(R.layout.fragment_study) {

    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
        super.onViewCreated(view, savedInstanceState)
        recycle_view.layoutManager = LinearLayoutManager(context)
        recycle_view.adapter = StudyAdapter()
    }

    inner class StudyAdapter : RecyclerView.Adapter<StudyAdapter.MyViewHolder>() {
        override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): MyViewHolder {
            val view = LayoutInflater.from(parent.context)
                    .inflate(R.layout.item_fragment_study, parent, false)
            return MyViewHolder(view)
        }

        override fun onBindViewHolder(holder: MyViewHolder, position: Int) {
            holder.itemView.item_course_poster.setImageResource(R.drawable.icon_large1)
            holder.itemView.item_course_title.text = "架构师体系课"
            holder.itemView.item_course_label.text = "架构师"
            holder.itemView.item_course_progress.text = "已学.100%"
        }

        override fun getItemCount(): Int {
            return 20
        }

        inner class MyViewHolder(view: View) : RecyclerView.ViewHolder(view) {

        }

    }

}